package com.agile.leetcode.string.internal;

import java.util.Random;

/**
 * @Author:ChenZhangKun
 * @Date: 2023/7/7 9:56
 */
public class InternalDemo {
    static final Integer MAX=10*1000;
    static final String[] arr=new String[MAX];
    public static void main(String[] args) {
        Integer[] DB_DATA=new Integer[10];
        Random rand = new Random(MAX);
        for (int i = 0; i < DB_DATA.length; i++) {
            DB_DATA[i]=rand.nextInt();
        }
        long t=System.currentTimeMillis();

        for (Integer i = 0; i < MAX; i++) {

            arr[i]= String.valueOf(DB_DATA[i % DB_DATA.length]).intern();
        }
        // 调用intern 时间为9 不调用为10
        long t1=System.currentTimeMillis();

        System.out.println(t1-t);
    }
}
